package pattern.chain_of_responsibility.login;

public class LoginHandler extends Handler {
    @Override
    public void doHandler(User user) {
        if (!"wlj".equals(user.getUsername()) || !"123456".equals(user.getPassword())) {
            System.out.println("用户名或密码错误");
            return;
        }
        user.setRole("admin");
        System.out.println("登录成功！角色为管理员");
        next.doHandler(user);
    }
}
